SpeakOne "Hello, I'm Eliza. Tell me your problems.", "Hi, I'm Doctor Eliza. Tell me your problems.", "Hi, this is Eliza. Let me help you. Tell me your problems.", "I am Eliza. How do you do. What is your name?"
-- here is the biggie. Doctor (Ms.) Eliza herself.
--
on Eliza
Global HumanName
Global StashedResponse
Global OriginalMessage
set cursor to 4
put card field 2 into WhatISaid
put empty into card field 2
put card field 1 into response
put word 1 of response into A
put word 2 of response into B
put word 3 of response into C
put A && B into AB
put AB && C into ABC
if (the random of 10) is 1 then put response into StashedResponse
put Trim(ReverseRole(butFirst(response,2))) into TRBF
-- no response
if response is empty then
SpeakOne "Please do speak.", "What's troubling your mind ?", "Let me help you with your problems.", "Hm ..."
exit Eliza
end if
-- "Can you ..."
if AB is "Can you" then
SpeakOne "Don't you believe that I can " & TRBF & " ?", "Perhaps you would like to be able to " & TRBF, "You want me to be able to " & TRBF, "One can do anything one wills, if the will is strong enough."
exit Eliza
end if
-- "Can I ..."
if AB is "Can I" then
SpeakOne "Perhaps you don't want to " & TRBF, "Do you want to be able to " & TRBF, "If you think you can, you can."
exit Eliza
end if
-- "You are ..." or "You're ..."
if AB is "You are" or A is "Youre" then
if response contains "no" or response contains "not" then
SpeakOne "Why do you think I'm not " & TRBF & " ?", "Why not ?", "Why are't I?"
exit Eliza
else
SpeakOne "What makes you think I am " & TRBF, "Does it please you to believe I'm " & TRBF, "Perhaps you would like to be " & TRBF, "Do you sometimes wish you were " &TRBF
exit Eliza
end if
end if
-- "I dont ..."
if AB is "I dont" or ABC is "I do not" then
SpeakOne "Don'y you really " & TRBF, "Really, now ...", "Why don't you " & TRBF, "Do you wish to be able to " & TRBF, "Does that trouble you ?", "Does it mean that much to you ?"
exit Eliza
end if
-- "I feel ..."
if AB is "I feel" then
SpeakOne "Tell me more about such feelings.", "Hm ...", "Do you often feel " & TRBF, "Do you enjoy feeling " & TRBF, "Does it worry you to feel " & TRBF
exit Eliza
end if
-- "Why dont you ..."
if ABC is "why dont you" then
SpeakOne "Do you really believe that I dont " & TRBF, "Perhaps in good time I will " & TRBF, "Do you want me to " & TRBF
exit Eliza
end if
-- "Why cant I ..."
if ABC is "why cant I" then
SpeakOne "Do you think you should be able to " & TRBF, "Why can't you " & TRBF, "I think you know the answer."
exit Eliza
end if
-- "Are you ..."
if AB is "are you" then
SpeakOne "Why are you interested in whether or not I am " & TRBF, "Would you prefer if I were not " & TRBF, "Perhaps in your fantasies I am " & TRBF
exit Eliza
end if
-- "I cant ..."
-- pick up name in response to question "what is your name"
if WhatISaid contains "what is your name" and the number of words in response < 3 then
beep
put "My name is " before response -- to be taken care of next
end if
-- "My name is ..."
if word 1 to 3 of response is "My name is" then
put line 3 of breakKey(response,"My name is") into HumanName
put word 1 of HumanName & "'s Response" into card field 4
SpeakOne "Good, " & HumanName & ". Nice to meet you.", HumanName & ", let me know your problems.", "Go on ..."
exit Eliza
end if
-- "Can I ask you ..."
if word 1 to 4 of response is "can I ask you" then
put line 3 of Trim(breakKey(response,"can I ask you")) into temp
SpeakOne "Go right ahead, " & HumanName, "Please do.", "Why would you ask me " & reverseRole(temp) & " ?", "Why ?"
exit Eliza
end if
-- "Hello" or "Hi"
if response contains "Hello" or response contains "Hi" then
SpeakOne "Hello.", "Hi !", "Hello. Now tell me your problems.", "Nice to meet you.", "Hello, what is your name?"
exit Eliza
end if
-- "How do you do"
if response contains "How do you do" then
if HumanName is empty then Articulate "What is your name?" else SpeakOne "How do you do.", "Nice to meet you."
exit Eliza
end if
-- "How are you?"
if response is "how are you" then
Articulate "Fine. How about you?"
exit Eliza
end if
-- short response
if length of response < 5 and the random of 5 is 1 then
SpeakOne "...", "Hm ...", "You are not very talkative today", "Please, calm down, " & HumanName,""
exit Eliza
end if
-- "goodbye"
if A is "goodbye" then
Articulate "good-bye."
visual effect dissolve
go home
exit Eliza
end if
-- no cases; fell through == make use of the stashed response
if (the random of 5 is 1) and StashedResponse is not empty then
Articulate "Earlier you said, '" & StashedResponse &"'"
exit Eliza
end if
-- no cases; fell through
SpeakOne "", "Hm ...", "Please go on.", "I see.", "Want to discuss your psychological problems now ?", "What does that suggest to you ?", "That is quite interesting.", "I'm not sure I understand you fully.", "What do you mean ?", "Come, come, elucidate on your thoughts.", "Really ?", "Can you elaborate on that ?", "Perhaps we may talk about your childhood ?"
end Eliza
on Articulate msg
click at loc of card field 2
type msg
put empty into message
click at loc of message
type " " & the numToChar of 8
end Articulate
on SpeakOne
Articulate the param of (the random of the paramcount)